package cn.wolfcode.wolf2world.web.controller;

import cn.wolfcode.wolf2world.domain.Spot;
import cn.wolfcode.wolf2world.query.SpotQueryObject;
import cn.wolfcode.wolf2world.service.DestinationService;
import cn.wolfcode.wolf2world.service.SpotService;
import cn.wolfcode.wolf2world.vo.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.Collection;
import java.util.List;

/**
 * @author 杨兴健
 * @Date 2020-08-12 22:51
 */
@Controller
@RequestMapping("/spots")
public class SpotController {
    @Autowired
    private SpotService spotService;

    /**
     * @return
     */
    @RequestMapping("/list")
    @ResponseBody
    public Object list() {
        List<Spot> spots = spotService.list();

        return JsonResult.success(spots);
    }



    @RequestMapping("/detail")
    @ResponseBody
    public Object detail(String id) {
        Spot spot = spotService.get(id);
        return JsonResult.success(spot);
    }

}
